package cn.edu.zjut.mina.action;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.data.domain.Page;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import cn.edu.zjut.mina.po.TotalGameResult;
import cn.edu.zjut.mina.po.UserInfo;
import cn.edu.zjut.mina.service.IInquireService;
import cn.edu.zjut.mina.service.ILoginService;

@Controller
@RestController
@RequestMapping("/login")
public class LoginAction {
	
	@Qualifier("loginService")
	@Autowired
	private ILoginService loginService;
	
//	@RequestMapping(value="/dologin/{id}", produces = "application/json;charset=UTF-8")
//	public String login(@RequestParam("uname")String username, @PathVariable("id") Integer id){
//		return "success:"+username;
//	}
	
	
	@RequestMapping(value="/dofirstlogin", produces = "application/json;charset=UTF-8")
	public String firstLogin(@RequestParam("code")String code){
		return loginService.firstLogin(code);
	}
	
	@RequestMapping(value="/dosecondlogin", produces = "application/json;charset=UTF-8")
	public String secondLogin(@RequestParam("openid")String openid){
		return loginService.secondLogin(openid);
	}
	
//	@Qualifier("inquireService")
//	@Autowired
//	private IInquireService inquireService;
//	/**
//	 * 查询战绩
//	 * @param userId  请求用户的Id
//	 * @param page   请求第几页
//	 * @param pagenum   每页请求多少条 信息
//	 * @return
//	 */
//	@RequestMapping(value="/combatgains", produces = "application/json;charset=UTF-8")
//	public String combatGains(@RequestParam("userId")String userId, @RequestParam("page")String page, @RequestParam("pagenum")String pagenum){
//		inquireService.inquireTotal();
//		return "  231 ";
//	}
}
